package com.lxk.weixin;

import com.github.wxpay.sdk.WXPayConfig;
import java.io.*;

/**
 * 微信支付相关配置
 * @author JohnSoybean
 *
 */
public class MyWxPayConfig implements WXPayConfig{
	
	/**
	 * 服务器证书放置位置
	 */
	private static String certPath = "/usr/local/cert/apiclient_cert.p12";
	
	/**
	 * 配置信息
	 */
	private static String appId = "wx3e07e0cdba5afe49";
	private static String mchId = "1580821911";
	private static String key = "QIANJIA1JU2J3B4HY5HM3MG2FD4F2GGT";

    private byte[] certData;

    public MyWxPayConfig() throws Exception {
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    public String getAppID() {
    	return appId;
    }

    public String getMchID() {
        return mchId;
    }

    public String getKey() {
        return key;
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }
}
